function kte = computeKte(i,elements,model)
e = model.getElement(i-1);
f = e.getFace();
C = elements(i).constitutiveMatrix;
dim = 2;
nn = f.countModes();
ng = e.getNumGaussPoint();
ke = zeros(dim*nn,dim*nn);
for j=1:ng
    xi = e.getGaussPoint(j-1);
    w = e.getGaussWeight(j-1);
    jac = e.getFace().jacXAt(xi);
    detJac = det(jac);
    B = zeros(3,dim*nn);
    B = e.computeB(f,B,xi);
    ke = ke + w*B'*C*B*abs(detJac);
end
Gamma = elements(i).Gamma;
H = elements(i).H;
kte = ke - Gamma'*(H\Gamma);
kte
end
